#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>

void *first_pthread(void *args)
{
    printf("第一个线程(%d)开始执行\n", gettid());
}

void *second_pthread(void *args)
{
    printf("第二个线程(%d)开始执行\n", gettid());
}

int main(int argc, char const *argv[])
{
    printf("main线程(%d)开始执行\n", gettid());

    pthread_t pt1, pt2 = 0;
    pthread_create(&pt1, NULL, first_pthread, NULL);
    pthread_create(&pt2, NULL, second_pthread, NULL);

    printf("pt1=%ld, pt2=%ld\n", pt1, pt2);

    pthread_join(pt1, NULL);
    pthread_join(pt2, NULL);
    printf("main线程(%d)即将执行完毕\n", gettid());
    return 0;
}
